

HOST = "localhost"
PORT = 5000
path="/main/register"

import httplib, urllib, urllib2
from indra.base.llsd import format_xml

def CAP(data):
    """post to an url"""
    params = urllib.urlencode(data)
    #headers = {"Accept": "text/plain", 'Content-Type':'application/x-www-form-urlencoded'}
    headers = {"Accept": "application/xml", 'Content-Type':'application/xml'}
    conn = httplib.HTTPConnection(HOST,PORT)
    conn.request("PUT", path, params, headers)
    r1 = conn.getresponse()
    resdata = r1.read()
    conn.close()
    return resdata

if __name__=="__main__":
    data={
        'origin'    : 'http://mrtopf.de/blog',
        'title'     : 'homepage',
    }
    
    print CAP({'data': format_xml(data)})







